$PBExportHeader$w_system_error.srw
$PBExportComments$Ventana que muestra el error producido en la Aplicacion, lo graba en l aBase de Datos y permite al usuario continuar o salir del sistema e imprimir el error.
forward
global type w_system_error from w_response
end type
type dw_error from uo_dw within w_system_error
end type
type cb_imprimir from commandbutton within w_system_error
end type
type cb_salir from commandbutton within w_system_error
end type
type cb_continuar from commandbutton within w_system_error
end type
end forward

global type w_system_error from w_response
int Width=2651
int Height=1012
dw_error dw_error
cb_imprimir cb_imprimir
cb_salir cb_salir
cb_continuar cb_continuar
end type
global w_system_error w_system_error

event open;call super::open;DateTime    fh
Integer		row
long rtn 
fh = DateTime(today(), now())

dw_error.uof_SetDataObject('d_system_error')
dw_error.SetTransObject(SQLCA)


row = dw_error.insertrow (0)

dw_error.setitem (row,"nro_error",error.number)
dw_error.setitem (row,"mensaje_error",error.text)
dw_error.setitem (row,"lugar",error.windowmenu)
dw_error.setitem (row,"objeto",error.object)
dw_error.setitem (row,"evento",error.objectevent)
dw_error.setitem (row,"linea_script",error.line)
dw_error.setitem (row,"fecha_hora",fh)

/* Asigno la dw de impresion */
dw_error.uof_SetdwImpresion('d_system_error_impresion')

/* Controlo que la transaccion este abierta todavia */
rtn = SQLCA.dbhandle()
If rtn = 0 or IsNull(rtn) Then Return;

/* Inserto el Error en la Base de Datos */
IF dw_error.Update(TRUE,TRUE) <> 1 THEN
//	ROLLBACK USING SQLCA;
	MessageBox("Error","Error al grabar mensaje de error en la Base de Datos~n~nMensaje : " + SQLCA.SQLErrText,StopSign!)
ELSE
//	COMMIT USING SQLCA;
END iF

//INSERT INTO dba.par_error_sistema 
//     (nro_error,
//	   fecha_hora,
//		lugar,
//		objeto,
//		evento,
//		linea_script,
//		mensaje_error)
//	VALUES (:error.number, 
//	        :fh, 
//	        :error.windowmenu, 
//			  :error.object,
//			  :error.objectevent,
//			  :error.line,
//			  :error.text)
//	USING SQLCA;
//	
//IF SQLCA.SQLCode = -1 then
//	Rollback Using SQLCA;
//	MessageBox("Error","Error al grabar mensaje de error~n~nMensaje : " + SQLCA.SQLErrText,StopSign!)
//Else
//	Commit Using SQLCA;
//End If
end event

on w_system_error.create
int iCurrent
call super::create
this.dw_error=create dw_error
this.cb_imprimir=create cb_imprimir
this.cb_salir=create cb_salir
this.cb_continuar=create cb_continuar
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.dw_error
this.Control[iCurrent+2]=this.cb_imprimir
this.Control[iCurrent+3]=this.cb_salir
this.Control[iCurrent+4]=this.cb_continuar
end on

on w_system_error.destroy
call super::destroy
destroy(this.dw_error)
destroy(this.cb_imprimir)
destroy(this.cb_salir)
destroy(this.cb_continuar)
end on

type pb_continuar from w_response`pb_continuar within w_system_error
int TabOrder=50
boolean Visible=false
boolean BringToTop=true
end type

type pb_cancelar from w_response`pb_cancelar within w_system_error
int TabOrder=40
boolean Visible=false
boolean BringToTop=true
end type

type dw_error from uo_dw within w_system_error
int X=64
int Y=48
int Width=2505
int Height=700
int TabOrder=30
string DataObject="d_system_error"
boolean Border=true
BorderStyle BorderStyle=StyleLowered!
boolean HScrollBar=false
boolean VScrollBar=false
boolean LiveScroll=false
end type

type cb_imprimir from commandbutton within w_system_error
int X=2002
int Y=780
int Width=567
int Height=104
int TabOrder=20
string Text="&Imprimir"
int TextSize=-10
int Weight=400
string FaceName="MS Sans Serif"
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

event clicked;/* Imprimo la dw de impresion */
dw_error.uof_Imprimir()
end event

type cb_salir from commandbutton within w_system_error
int X=59
int Y=776
int Width=567
int Height=108
int TabOrder=10
string Text="&Salir del Sistema"
boolean Default=true
int TextSize=-10
int Weight=400
string FaceName="MS Sans Serif"
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

event clicked;Halt Close
end event

type cb_continuar from commandbutton within w_system_error
int X=1051
int Y=780
int Width=567
int Height=104
int TabOrder=11
string Text="&Continuar"
int TextSize=-10
int Weight=400
string FaceName="MS Sans Serif"
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

event clicked;Close(parent)
end event

